package com.imooc.spring.ioc.class017;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

//@Component
public class TestBean implements InitializingBean, DisposableBean {
    @Override
    public void destroy() throws Exception {
        System.out.println("TestBean.destroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("TestBean.afterPropertiesSet");
    }

    @PostConstruct
    public void onInit() {
        System.out.println("TestBean.onInit");
    }
    @PreDestroy
    public void onDestroy() {
        System.out.println("TestBean.onDestroy");
    }
    // 方法3
    public void onInit1() {
        System.out.println("TestBean.onInit1");
    }
    public void onDestroy1() {
        System.out.println("TestBean.onDestroy1");
    }

}
